@using System.Globalization
@model SampleWebsite.Mvc3.Areas.MvcMembership.Models.UserAdministration.DetailsViewModel
@{
    ViewBag.Title = "User Roles";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h3>
    User Roles: <span class="accent">@Model.DisplayName</span>
</h3>

<script type="text/javascript">
    $(function () {
        $(".action").button();
    });

    
</script>

<div class="mvcMembership-userRoles">
    <table style="width: auto">
        <tr>
            <th>
                Role Name
            </th>
            <th>
                Details
            </th>
            <th>
            </th>
        </tr>
        @foreach (var role in Model.Roles)
        {
            <tr>
                <td>
                    @role.Key
                </td>
                <td>
                    @Html.ActionLink(role.Key, "Role", new { id = role.Key }, new { @class = "ui-icon ui-icon-search" })
                </td>
                <td>
                    @if (role.Value)
                    {
                        using (Html.BeginForm("RemoveFromRole", "UserAdministration", new { id = Model.User.ProviderUserKey, role = role.Key }))
                        {
                        @*<button type="submit" class="action">Remove From</button>*@
                        <a href="#" onclick="$(this).closest('form').submit()" class="action" style="width:150px">Remove From</a>
                        @*<input type="submit" value="Remove From" class="action" />*@
                        }
                    }
                    else
                    {
                        using (Html.BeginForm("AddToRole", "UserAdministration", new { id = Model.User.ProviderUserKey, role = role.Key }))
                        {
                        @*<button type="submit" class="action">Add To</button>*@
                        <a href="#" onclick="$(this).closest('form').submit()" class="action" style="width:150px">Add To</a>
                        @*<input type="submit" value="Add To"  class="action" />*@
                        }
                    }
                </td>
            </tr>
        }
    </table>
    <p>
        @Html.ActionLink("Back to Details", "Details", new { id = Model.User.ProviderUserKey }, new { @class = "btl" })
    </p>
</div>
